﻿<?php
exit;
include './c/config.php';
date_default_timezone_set('PRC');
/* 非加密接口demo */
define("YM_SMS_ADDR",           		"www.btom.cn:8080");/*接口地址,请联系销售获取*/
define("YM_SMS_SEND_URI",       		"/simpleinter/sendSMS");/*发送短信接口*/
define("YM_SMS_SEND_PER_URI",       	"/simpleinter/sendPersonalitySMS");/*发送个性短信接口*/
define("YM_SMS_GETREPORT_URI",  		"/simpleinter/getReport");/*获取状态报告接口*/
define("YM_SMS_GETMO_URI",      		"/simpleinter/getMo");/*获取上行接口*/
define("YM_SMS_GETBALANCE_URI", 		"/simpleinter/getBalance");  /*获取余额接口*/
define("YM_SMS_APPID",          		$smsAppid);/*APPID,请联系销售或者在页面获取*/
define("YM_SMS_AESPWD",         		$smsPd);/*密钥，请联系销售或者在页面获取*/
define("END",               "\n");
    
function http_request($url, $data)
{
    print_r($url);
    print_r(END);
    print_r($data);
    print_r(END);
    $data = http_build_query($data);	
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_POST, TRUE);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
    $output = curl_exec($curl);
    curl_close($curl);
    print_r($output);
    return $output;
}

function signmd5($appId,$secretKey,$timestamp){
	return md5($appId.$secretKey.$timestamp);
}


$content = "【谦玛】验证码079395，您正在登录小游戏，若非本人操作，请勿泄露。";/* 短信内容请以商务约定的为准，如果已经在通道端绑定了签名，则无需在这里添加签名 */
$timestamp = date("YmdHis");
$sign = signmd5(YM_SMS_APPID,YM_SMS_AESPWD,$timestamp);
// 如果您的系统环境不是UTF-8，需要转码到UTF-8。如下：从gb2312转到了UTF-8
// $content = mb_convert_encoding( $content,"UTF-8","gb2312");
// 另外，如果包含特殊字符，需要对内容进行urlencode
$data = array(
    "appId" => YM_SMS_APPID,
    "timestamp" => $timestamp,
    "sign" => $sign,
    "mobiles" => "18600792521",
    "content" =>  $content
);
$url = YM_SMS_ADDR.YM_SMS_SEND_URI;
$resobj = http_request($url, $data);

 
   


?>
